﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Gene_Explorer_Client
{
    public partial class OrderWizardCluster : Form
    {
        public bool FCMFlag = false;
        public bool GMMFlag = false;
        public bool HierachicalFlag = false;
        public bool KmeansFlag = false;
        public bool SOMFlag = false;


        public OrderWizardCluster()
        {
            InitializeComponent();
        }

        private void button_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void OrderWizardCluster_Load(object sender, EventArgs e)
        {

        }

        private void button_Next_Click(object sender, EventArgs e)
        {
            GlobalVariable.orderWC = this;
            this.Hide();
            OrderWizardValidation oWV = new OrderWizardValidation();
            if (!GlobalVariable.orderWSD.checkBox_Classification.Checked)
            {
                oWV.checkBox_ARI.Enabled = false;
                oWV.checkBox_RI.Enabled = false;
                oWV.label12.Visible = true;
                oWV.label13.Visible = true;
            }
            oWV.Show();
        }

        private void button_Back_Click(object sender, EventArgs e)
        {
            GlobalVariable.orderWC = this;
            this.Hide();
            OrderWizardDataProcessing oWDP = new OrderWizardDataProcessing();
            oWDP = GlobalVariable.orderWDP;
            oWDP.Show();
        }

        private void checkBox_FCM_CheckedChanged(object sender, EventArgs e)
        {
            //label15  textBox_FCMCluster  label17  textBox_FCMCount
            label15.Enabled = !label15.Enabled;
            textBox_FCMCluster.Enabled = !textBox_FCMCluster.Enabled;
            label17.Enabled = !label17.Enabled;
            textBox_FCMCount.Enabled = !textBox_FCMCount.Enabled;
            /*
            if (FCMFlag == false)
            {
                label15.Enabled = true;
                textBox_FCMCluster.Enabled = true;
                label17.Enabled = true;
                textBox_FCMCount.Enabled = true;
            }
            else
            {
                label15.Enabled = false;
                textBox_FCMCluster.Enabled = false;
                label17.Enabled = false;
                textBox_FCMCount.Enabled = false;
            }
            FCMFlag = !FCMFlag;
             */ 
        }

        private void checkBox_GMM_CheckedChanged(object sender, EventArgs e)
        {
            //label1  textBox_GMMCluster  label2  comboBox_Modeltype  label3  textBox_EMTimes
            label1.Enabled = !label1.Enabled;
            textBox_GMMCluster.Enabled = !textBox_GMMCluster.Enabled;
            label2.Enabled = !label2.Enabled;
            comboBox_Modeltype.Enabled = !comboBox_Modeltype.Enabled;
            label3.Enabled = !label3.Enabled;
            textBox_EMTimes.Enabled = !textBox_EMTimes.Enabled;
            /*
            if (GMMFlag == false)
            {
                label1.Enabled = true;
                textBox_GMMCluster.Enabled = true;
                label2.Enabled = true;
                comboBox_Modeltype.Enabled = true;
                label3.Enabled = true;
                textBox_EMTimes.Enabled = true;
            }
            else
            {
                label1.Enabled = false;
                textBox_GMMCluster.Enabled = false;
                label12.Enabled = false;
                comboBox_Modeltype.Enabled = false;
                label3.Enabled = false;
                textBox_EMTimes.Enabled = false;
            }
            GMMFlag = !GMMFlag;
             */ 
        }

        private void checkBox_Hierachical_CheckedChanged(object sender, EventArgs e)
        {
            //label4  textBox_HierachicalCluster  label5  comboBox_ClusterDistance  label6  comboBox_Measuredistance
            label4.Enabled = !label4.Enabled;
            textBox_HierachicalCluster.Enabled = !textBox_HierachicalCluster.Enabled;
            label5.Enabled = !label5.Enabled;
            comboBox_ClusterDistance.Enabled = !comboBox_ClusterDistance.Enabled;
            label6.Enabled = !label6.Enabled;
            comboBox_Measuredistance.Enabled = !comboBox_Measuredistance.Enabled;

            if (comboBox_Measuredistance.SelectedIndex == 2)
            {
                label18.Enabled = !label18.Enabled;
                comboBox_Power1.Enabled = !comboBox_Power1.Enabled;

            }
            /*
            if (HierachicalFlag == false)
            {
                label4.Enabled = true;
                textBox_HierachicalCluster.Enabled = true;
                label5.Enabled = true;
                comboBox_ClusterDistance.Enabled = true;
                label6.Enabled = true;
                comboBox_Measuredistance.Enabled = true;

            }
            else
            {
                label4.Enabled = false;
                textBox_HierachicalCluster.Enabled = false;
                label5.Enabled = false;
                comboBox_ClusterDistance.Enabled = false;
                label6.Enabled = false;
                comboBox_Measuredistance.Enabled = false;
            }
            HierachicalFlag = !HierachicalFlag;
             */ 

        }

        private void checkBox_Kmeans_CheckedChanged(object sender, EventArgs e)
        {
            //label7  textBox_KmeansCluster  label8  comboBox_KmeansMeasuredistance  label9  comboBox_KmeansInimethod

            label7.Enabled = !label7.Enabled;
            textBox_KmeansCluster.Enabled = !textBox_KmeansCluster.Enabled;
            label8.Enabled = !label8.Enabled;
            comboBox_KmeansMeasuredistance.Enabled = !comboBox_KmeansMeasuredistance.Enabled;
            label9.Enabled = !label9.Enabled;
            comboBox_KmeansInimethod.Enabled = !comboBox_KmeansInimethod.Enabled;
            if (comboBox_KmeansMeasuredistance.SelectedIndex == 2)
            {
                label19.Enabled = !label19.Enabled;
                comboBox_Power2.Enabled = !comboBox_Power2.Enabled;
            }
            /*
            if (KmeansFlag == false)
            {
                label7.Enabled = true;
                textBox_KmeansCluster.Enabled = true;
                label8.Enabled = true;
                comboBox_KmeansMeasuredistance.Enabled = true;
                label9.Enabled = true;
                comboBox_KmeansInimethod.Enabled = true;
            }
            else
            {
                label7.Enabled = false;
                textBox_KmeansCluster.Enabled = false;
                label8.Enabled = false;
                comboBox_KmeansMeasuredistance.Enabled = false;
                label9.Enabled = false;
                comboBox_KmeansInimethod.Enabled = false;
            }
            KmeansFlag = !KmeansFlag;
             */ 
        }

        private void checkBox_SOM_CheckedChanged(object sender, EventArgs e)
        {
            //label10  comboBox_SOMTopology  label11  textBox_SOMRow  label12  textBox_SOMColumn
            //label13  comboBox_SOMMeasuredistance    label14   textBox_SOMIteratetime
            label10.Enabled = !label10.Enabled;
            comboBox_SOMTopology.Enabled = !comboBox_SOMTopology.Enabled;
            label11.Enabled = !label11.Enabled;
            textBox_SOMRow.Enabled = !textBox_SOMRow.Enabled;
            label12.Enabled = !label12.Enabled;
            textBox_SOMColumn.Enabled = !textBox_SOMColumn.Enabled;
            label13.Enabled = !label13.Enabled;
            comboBox_SOMMeasuredistance.Enabled = !comboBox_SOMMeasuredistance.Enabled;
            label14.Enabled = !label14.Enabled;
            textBox_SOMIteratetime.Enabled = !textBox_SOMIteratetime.Enabled;
                
            if (comboBox_SOMMeasuredistance.SelectedIndex == 2)
            {
                label16.Enabled = !label16.Enabled;
                comboBox_Power3.Enabled = !comboBox_Power3.Enabled;
            }
            /*
            if (SOMFlag == false)
            {
                label10.Enabled = true;
                comboBox_SOMTopology.Enabled = true;
                label11.Enabled = true;
                textBox_SOMRow.Enabled = true;
                label12.Enabled = true;
                textBox_SOMColumn.Enabled = true;
                label13.Enabled = true;
                comboBox_SOMMeasuredistance.Enabled = true;
                label14.Enabled = true;
                textBox_SOMIteratetime.Enabled = true;
            }
            else
            {
                label10.Enabled = false;
                comboBox_SOMTopology.Enabled = false;
                label11.Enabled = false;
                textBox_SOMRow.Enabled = false;
                label12.Enabled = false;
                textBox_SOMColumn.Enabled = false;
                label13.Enabled = false;
                comboBox_SOMMeasuredistance.Enabled = false;
                label14.Enabled = false;
                textBox_SOMIteratetime.Enabled = false;
            }
            SOMFlag = !SOMFlag;
             */ 
        }

        private void comboBox_Measuredistance_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox_Measuredistance.SelectedIndex == 2)
            {
                label18.Enabled = true;
                comboBox_Power1.Enabled = true;
            }
            else
            {
                label18.Enabled = false;
                comboBox_Power1.Enabled = false;
            }
        }

        private void comboBox_KmeansMeasuredistance_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox_KmeansMeasuredistance.SelectedIndex == 2)
            {
                label19.Enabled = true;
                comboBox_Power2.Enabled = true;
            }
            else
            {
                label19.Enabled = false;
                comboBox_Power2.Enabled = false;
            }
        }

        private void comboBox_SOMMeasuredistance_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox_SOMMeasuredistance.SelectedIndex == 2)
            {
                label16.Enabled = true;
                comboBox_Power3.Enabled = true;
            }
            else
            {
                label16.Enabled = false;
                comboBox_Power3.Enabled = false;
            }
        }

        private void textBox_FCMCluster_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_GMMCluster_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_HierachicalCluster_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_KmeansCluster_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_SOMRow_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_SOMColumn_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_SOMIteratetime_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_FCMCount_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }

        private void textBox_EMTimes_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = e.KeyChar < '0' || e.KeyChar > '9';
            if (e.KeyChar == (char)8)
            {
                e.Handled = false;
            }
        }
    }
}
